﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class UserControl_popularMenu : System.Web.UI.UserControl
{
    CategoryController cateControl;
    DanhmucsanphamController danhmucsanphamControl;
    DanhmucPhukienController danhmucphukienControl;

    DataTable dtCate;
    DataTable dtDanhmucsanpham;
    DataTable dtDanhmucphukien;

    public List<Category> listCate = new List<Category>();
    public List<DanhmucPhukien> listDanhmucphukien = new List<DanhmucPhukien>();
    public List<Danhmucsanpham> listDanhmucsanpham = new List<Danhmucsanpham>();
    protected void Page_Load(object sender, EventArgs e)
    {
        cateControl = new CategoryController();
        danhmucphukienControl = new DanhmucPhukienController();
        danhmucsanphamControl = new DanhmucsanphamController();

        dtCate = cateControl.getAllCategory();
        dtDanhmucphukien = danhmucphukienControl.GetAll();
        dtDanhmucsanpham = danhmucsanphamControl.GetAll();

        LoadCate();
        LoadDanhmucphukien();
        LoadDanhmucsanpham();
    }

    public void LoadCate()
    {
        foreach (DataRow item in dtCate.Rows)
        {
            listCate.Add(new Category(item));
        }
    }
    public void LoadDanhmucphukien()
    {
        foreach (DataRow item in dtDanhmucphukien.Rows)
        {
            listDanhmucphukien.Add(new DanhmucPhukien(item));
        }
    }
    public void LoadDanhmucsanpham()
    {
        foreach (DataRow item in dtDanhmucsanpham.Rows)
        {
            listDanhmucsanpham.Add(new Danhmucsanpham(item));
        }
    }
}